<script>
    function add(x,y,z){
        return x + y + z;
    }
    function currying (fn) {
        function curried(...args){
            //柯里化过程完成
            if(args.length>=fn.length){
                return fn.apply(this,args)
            }else{
                function curried2(...args2){
                    return curried.apply(this,args.concat(args2))
                }
                return curried2
            }
        }
        return curried
    }
    let curryAdd = currying(add)
    console.log(curryAdd(10,20,30))
    console.log(curryAdd(20,30)(40))
</script>